package com.hspedu.transformation;

import java.io.*;

/**
 * @author DL5O
 * @version 1.0
 * 演示 OutputStreamWriter的使用
 * 把FileOutPutStream 字节流转成字符流 OutputStreamWriter
 * 指定处理的编码形式 gbk/utf-8/utf8
 */
public class OutputStreamWriter_ {
    public static void main(String[] args) throws IOException {
        String filePath = "d:\\ywl.txt";
        String charset = "utf-8";
        OutputStreamWriter gbk = new OutputStreamWriter(new FileOutputStream(filePath), charset);
        BufferedWriter bw = new BufferedWriter(gbk);
        bw.write("大家看我，我宣布个事儿~~");
        bw.close();
        System.out.println("保存文件成功~~");

    }
}
